<?php

function appendInWhereClause(&$whereClause, $columnName, $columnValue, $prepend) {
    if ($whereClause == "") {
        $whereClause = ' WHERE ';
    }
    if ($columnValue != "") {
        if ($whereClause == ' WHERE ') {
            $whereClause .= " " . $columnName . " = '" . $columnValue . "' ";
        } else {
            $whereClause .= $prepend . " " . $columnName . " = '" . $columnValue . "' ";
        }
    }
}

?>